//	--------------------------------------------------------------------
//	Copyright(C) 2006,2007 Zhao Yukun. All rights reserved.
//	This file is a part of the Xeres system.
//	Xeres 2007
//	Contact : xeres.engine@gmail.com
//	$(reservedInfo)
//	$(reservedDeclaration)
//	--------------------------------------------------------------------
///	@file	<CStaticModelBatch.cpp>
///	@path	~/src/graphics/batch/
///	@date	2008/01/03
///	@desc	.

#include "config/config.h"

#include "lib/system/thread_debug.h"

#include "graphics/batch/CStaticModelBatch.h"

namespace xeres {

	IMPL_IOBJECT_CLASS_DYNAMIC( CStaticModelBatch );

	// ctor
	CStaticModelBatch::CStaticModelBatch( void )
	{
	}

	// dtor
	CStaticModelBatch::~CStaticModelBatch( void )
	{
	}
	
	// BeginBatch
	void CStaticModelBatch::BeginBatch( void )
	{
		// clear previous models
		m_batchList.clear();
	}
	// EndBatch
	void CStaticModelBatch::EndBatch( void )
	{

	}

	// Render
	void CStaticModelBatch::Render( RenderContext& rc )
	{
		TRACK_FUNCTION_SCOPE();
		RUNNING_ON_THREAD( _S("render|!_tick") );

		// render one by one
		for( _BatchList::iterator it = m_batchList.begin() , end = m_batchList.end() ; it != end ; ++it )
		{
			(*it)->Render( rc );
		}
	}
	// AddModel
	void CStaticModelBatch::AddModel( RefWeak<IModel> model )
	{
		m_batchList.insert( model );
	}

} // namespace xeres
